package com.xgy.backend.controller;

import com.xgy.backend.common.ResultUtils;
import com.xgy.backend.domain.Level0Board;
import com.xgy.backend.service.Level0BoardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Describe: buildingInfo controller layer
 * Author：Xie geyun
 * Time：2023/5/13
 */
@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    Level0BoardService level0BoardService;
    @GetMapping("/testGet")
    public Object getBuilding(){

        // 记录开始时间
        long startTime = System.nanoTime();

        List<Level0Board> list = level0BoardService.list();

        // 记录结束时间
        long endTime = System.nanoTime();
        // 计算执行时间差（以毫秒为单位）
        long executionTimeMillis = (endTime - startTime) / 1000000;

        System.out.println("顺序执行时间： " + executionTimeMillis + " 毫秒");

        return ResultUtils.success(list);
    }
}
